<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <meta content="telephone=no" name="format-detection">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link rel="stylesheet" type="text/css" href="${ctxPath}/static/police/css/common.css">
    <link rel="stylesheet" type="text/css" href="${ctxPath}/static/police/css/style.css">
</head>
<body>
<div class="header">
    <div class="header_wrap">
        <div class="system fl">
            <img src="${ctxPath}/static/police/images/logo1.png"/>
            <span>出租屋智能管理系统</span>
        </div>
        <div class="user fr">
            <div class="head"><img src="${ctxPath}/static/police/images/headImg.png"/><span class="user_name">${user.name!'管理员'}</span></div>
            <ul class="user_list">
                <li>修改密码</li>
                <li onclick="location.href='${ctxPath}/admin/logout'">退出</li>
            </ul>
        </div>
    </div>
</div>
<div class="left_Nav">
    <div class="scroll_box">
        <ul class="manage_Nav">
            <li class="active">
                <div class="title nav_1 cursor" data-index="0">主页</div>
                <ul class="submenu">
                    <li data-index="1">地图分布</li>
                </ul>
            </li>
            @if(isNotEmpty(menus[1])||isNotEmpty(menus[6])||admin==1){
            <li>
                <div class="title nav_2">权限管理</div>
                <ul class="submenu">
                    @if(isNotEmpty(menus[1])||admin==1){
                    <li data-index="2">管理员列表</li>
                    @}
                    @if(isNotEmpty(menus[6])){
                    <li data-index="3">角色列表</li>
                    @}
                </ul>
            </li>
            @}
            @if(isNotEmpty(menus[10])||isNotEmpty(menus[11])||isNotEmpty(menus[12])||admin==1){
            <li>
                <div class="title nav_3">人员管理</div>
                <ul class="submenu">
                    @if(isNotEmpty(menus[10])||admin==1){
                    <li data-index="4">房东列表</li>
                    @}
                    @if(isNotEmpty(menus[11])||admin==1){
                    <li data-index="5">租户列表</li>
                    @}
                    @if(isNotEmpty(menus[12])||admin==1){
                    <li data-index="6">房屋列表</li>
                    @}
                </ul>
            </li>
            @}
            @if(isNotEmpty(menus[13])||admin==1){
            <li>
                <div class="title nav_4">居住证管理</div>
                <ul class="submenu">
                    <li data-index="7">居住证申请</li>
                </ul>
            </li>
            @}
        </ul>
    </div>
</div>
<div class="main">
    <div class="manage_Right">
        <iframe src="${ctxPath}/admin/home/" width="100%" id="iframepage"  onload="changeFrameHeight()" scrolling="no">
        </iframe>
    </div>
</div>
<script type="text/javascript" src="${ctxPath}/static/police/js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="${ctxPath}/static/police/js/base.js"></script>
<script type="text/javascript">
    document.getElementById("iframepage").height=800;
    window.onresize=function(){
        changeFrameHeight();
    }
    var urlLink=[
        "${ctxPath}/admin/home/",
        "${ctxPath}/admin/room/map",
        "${ctxPath}/admin/manage/",
        "${ctxPath}/admin/role/",
        "${ctxPath}/admin/landlord/",
        "${ctxPath}/admin/tenant/",
        "${ctxPath}/admin/room/",
        "${ctxPath}/admin/live/"
    ]

    function reinitIframe(){
        var iframe = document.getElementById("iframepage");
        try{
            var bHeight = iframe.contentWindow.document.body.scrollHeight;
            var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
            var height = Math.max(bHeight, dHeight);
            iframe.height = height;
            console.log(height);
        }catch (ex){}
    }

    $(function(){
        $("#iframepage").onload = function() {
            setTimeout("reinitIframe()", 300)
        };
        $(".manage_Nav li .title, .manage_Nav li .submenu li").click(function(){
            if($(this).attr("data-index")){
               $(this).parents("li").addClass("active").siblings().removeClass("active").find("li").removeClass("active");
               if(!$(this).hasClass("title")){
                  $(this).addClass("active").siblings().removeClass("active");
               }
               var idx=$(this).attr("data-index");
               $("#iframepage").attr("src",urlLink[idx]);
            }
        })


        $("#iframepage").on("load", function(event){            //判断 iframe是否加载完成
            $("#add_manager",this.contentDocument).click(function(){//添加点击事件
                $("#iframepage").attr("src","${ctxPath}/admin/manage/add");
            });
        });

        $("#iframepage").on("load", function(event){            //判断 iframe是否加载完成
            $("#add_power",this.contentDocument).click(function(){//添加点击事件
                $("#iframepage").attr("src","${ctxPath}/admin/role/add");
            });
        });

        $("#iframepage").on("load", function(event){            //判断 iframe是否加载完成
            $(".edit",this.contentDocument).click(function(){//添加点击事件
                $("#iframepage").attr("src","${ctxPath}/admin/role/edit");
            });
        });

    })
</script>
</body>
</html>